#!/usr/bin/perl -T
# conjug.pl
use warnings;
# lack of use strict here

use CGI qw(:standard *table);
use WWW::Babelfish;
use Lingua::PT::Conjugate;

print header, start_html(-bgcolor => 'white', -title => "Conjugando");
if (!param(verb)) {
   my %tenses = 
      (pres  => Present,
       perf  => Perfect,
       imp   => Imperfect,
       fut   => Future,
       mdp   => Pluscuamperfect,
       cpres => 'Subjunctive Present',
       cimp  => 'Subjunctive Imperfect',
       cfut  => 'Subjunctive Future',
       ivo   => Imperative,
       pp    => 'Past Participle',
       grd   => Gerund);
   my @labels = keys %tenses;
   my %persons = 
      (1 => I,
       2 => You,
       3 => 'He/She/It',
       4 => We,
       5 => You,
       6 => They);
   my @labelsP = keys %persons;
 
After setting up data for the combo boxes (popup_menu), here comes the program itself:

print start_table({bgcolor => 'lightblue', cellspacing => 0,
                 cellpadding => 5}),
start_form,
Tr(td(["English Verb",
   textfield('verb')])), "\n",
Tr(td(['Tense',,
   popup_menu('tense' , \@labels, 'pres', \%tenses)])), "\n",
Tr(td(['Person',
   popup_menu('person', \@labelsP, 1, \%persons)])),
Tr(td({colspan => 2, align => 'center'}, submit())),
end_form, end_table;
} else {
   print h1("Translating ", param('verb'), " to ", param('tense'),
            " in person ", param('person')),
   p(em (conjug(translate(param('verb')), param('tense'), param('person')))
   );
}

print end_html;

sub translate {
   my ($toTranslate) = @_;
   my $tr = new WWW::Babelfish() || return $toTranslate;
   my $translated = $tr->translate('source' => 'English',
                                     'destination' => 'Portuguese',
                                     'text' => "$toTranslate");
  print $language, " ", $tr->error if $tr->error;
  $translated = $toTranslate unless defined ($translated);
  return $translated;
}
